import unittest

# loader
# loadTestFromName(str)
# loadTestFromNames(list/tuple)

# 模块名
# loader1 = unittest.defaultTestLoader.loadTestsFromName('test_cases.test_demo1')
# loader2 = unittest.defaultTestLoader.loadTestsFromNames(['test_cases.test_demo1', 'test_cases.test_demo2'])

# 类名
# loader3 = unittest.defaultTestLoader.loadTestsFromName('test_cases.test_demo1.Demo1TestCase')
# loader4 = unittest.defaultTestLoader.loadTestsFromNames(['test_cases.test_demo1.Demo1TestCase',
#                                                          'test_cases.test_demo2.Demo2TestCase'])

# 方法名
# loader5 = unittest.defaultTestLoader.loadTestsFromName('test_cases.test_demo1.Demo1TestCase.test1')
loader6 = unittest.defaultTestLoader.loadTestsFromNames(['test_cases.test_demo1.Demo1TestCase.test1',
                                                         'test_cases.test_demo2.Demo2TestCase.testb'])

# suite
suite = unittest.TestSuite()
suite.addTest(loader6)

# runner
runner = unittest.TextTestRunner(verbosity=2)
runner.run(suite)
